package com.guilin.system.service.impl;

import java.util.Collections;
import java.util.List;
import java.util.Map;

import com.guilin.common.utils.DateUtils;
import com.guilin.system.service.CareerDestinationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.guilin.mapper.CareerDestinationMapper;
import com.guilin.domain.CareerDestination;
import com.guilin.system.service.CareerDestinationService;

/**
 * 毕业去向Service业务层处理
 *
 * @author xiaoqi
 * @date 2025-06-23
 */
@Service
public class CareerDestinationServiceImpl implements CareerDestinationService
{
    @Autowired
    private CareerDestinationMapper careerDestinationMapper;

    /**
     * 查询毕业去向
     *
     * @param id 毕业去向主键
     * @return 毕业去向
     */
    @Override
    public CareerDestination selectCareerDestinationById(Long id)
    {
        return careerDestinationMapper.selectCareerDestinationById(id);
    }

    /**
     * 查询毕业去向列表
     *
     * @param careerDestination 毕业去向
     * @return 毕业去向
     */
    @Override
    public List<CareerDestination> selectCareerDestinationList(CareerDestination careerDestination)
    {
        return careerDestinationMapper.selectCareerDestinationList(careerDestination);
    }

    /**
     * 新增毕业去向
     *
     * @param careerDestination 毕业去向
     * @return 结果
     */
    @Override
    public int insertCareerDestination(CareerDestination careerDestination)
    {

        careerDestination.setCreateTime(DateUtils.getNowDate());
        return careerDestinationMapper.insertCareerDestination(careerDestination);
    }

    /**
     * 修改毕业去向
     *
     * @param careerDestination 毕业去向
     * @return 结果
     */
    @Override
    public int updateCareerDestination(CareerDestination careerDestination)
    {
        careerDestination.setUpdateTime(DateUtils.getNowDate());
        return careerDestinationMapper.updateCareerDestination(careerDestination);
    }

    /**
     * 批量删除毕业去向
     *
     * @param ids 需要删除的毕业去向主键
     * @return 结果
     */
    @Override
    public int deleteCareerDestinationByIds(Long[] ids)
    {
        return careerDestinationMapper.deleteCareerDestinationByIds(ids);
    }

    /**
     * 删除毕业去向信息
     *
     * @param id 毕业去向主键
     * @return 结果
     */
    @Override
    public int deleteCareerDestinationById(Long id)
    {
        return careerDestinationMapper.deleteCareerDestinationById(id);
    }


    /**
     * 统计每个职业类别的数量
     * @return
     */
    public List<Map<String, Object>> countByCategory() {

        return careerDestinationMapper.countByCategory();
    }


    /**
     * 根据校友ID查询毕业去向信息
     * @param alumniId
     * @return
     */
    public CareerDestination selectByAlumniId(Long alumniId) {

        return careerDestinationMapper.selectByAlumniId(alumniId);
    }
}
